package com.kede.api.order.controller;

import com.kede.api.order.pojo.ZhiMoneyOrderPO;
import com.kede.api.order.service.IZhiOrderService;
import com.kede.pojo.ResHttp;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 订单服务
 *
 * @author 11856
 * @date 2023/06/12
 */
@RequestMapping("order/zhi")
@RestController
public class ZhiOrderController {

    @Resource
    private IZhiOrderService zhiOrderService;

    /**
     * 获取置换订单某个一件物品的详细信息
     * @param zhiGoodId
     * @return
     */
    @GetMapping("getZhiGoodDetailInfoById")
    public ResHttp getZhiGoodDetailInfoById(Integer zhiGoodId){
        return zhiOrderService.getZhiGoodDetailInfoById(zhiGoodId);
    }


    @GetMapping("delZhiOrder")
    public ResHttp delZhiOrder(String orderSn){
        return zhiOrderService.delZhiOrder(orderSn);
    }


    /**
     * 门店确认置换 返积分+应收款
     * @param goodId
     * @return
     */
    @GetMapping("confirmZhiOrder")
    public ResHttp confirmZhiOrder(Integer goodId){
        return zhiOrderService.confirmZhiOrder(goodId);
    }



    /**
     * 创建德币置换订单
     * @param zhiMoneyOrderPO
     * @return
     */
    @PostMapping("addZhiOrder")
    public ResHttp addZhiOrder(@RequestBody @Validated ZhiMoneyOrderPO zhiMoneyOrderPO){
        return zhiOrderService.addZhiOrder(zhiMoneyOrderPO);
    }

}
